﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
using SqlSugar;

namespace WpfApp1
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        private CodesContext CC => (CodesContext)DataContext;

        public MainWindow()
        {
            InitializeComponent();
        }

        private void TV_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
        {
            CC.SelectedCode = (CodeNode)e.NewValue;
            textEditor.Text = CC.SelectedCode.Code.代码文本;
        }

        private void TV_PreviewMouseRightButtonUp(object sender, MouseButtonEventArgs e)
        {
            ((TreeViewItem)e.Source).Focus();
        }
    }
}